class code1 {
    //相向指针
    public boolean validPalindrome(String s) {
        int left = 0;
        int right = s.length()-1;
        while(left<=right) {
            if(s.charAt(left) != s.charAt(right)) {
                return pand(s,left+1,right)||pand(s,left,right-1);
            }
            left++;
            right--;
        }
        return true;
    }

    public boolean pand(String s,int left,int right) {
        while(left<=right) {
            if(s.charAt(left++) != s.charAt(right--)) {
                return false;
            }
        }
        return true;
    }
}